#include <asm/asm.h>
#include <asm/regdef.h>
#include <cpu.h>
#include <asm/context.h>
#include <inst_ex_test.h>

####LEAF(n64_sh_ex_test)
    .globl n64_sh_ex_test
n64_sh_ex_test:
    .set noreorder
    li  a0, 0x40
###test inst
    TEST_SH_EX(0xa5210b0a, 0x00e95990, 0xb79b73c3, 0x801063d7, 0x00007fc7, 0x00007fc4, 0xa5210b0a, 0x8010e39b)
    TEST_SH_EX(0x73b35a2b, 0xbd6f420a, 0x23795874, 0x80103519, 0x000064f0, 0x000064f0, 0x73b35a2b, 0x80109a09)
    TEST_SH_EX(0x5309c71c, 0x9fcc4ca0, 0x0af14b80, 0x80101ff3, 0x0000b660, 0x0000b660, 0x80111ff3, 0x8010d653)
    TEST_SH_EX(0xd146e220, 0x190a45ca, 0x8f0afc40, 0x80103729, 0x00008f61, 0x00008f60, 0x80113729, 0x8010c689)
    TEST_SH_EX(0x419f9f3b, 0xbb1afce8, 0x7ed576e9, 0x80101356, 0x00001dd0, 0x00001dd0, 0x419f9f3b, 0x80103126)
    TEST_SH_EX(0x18aec04e, 0x6e9ce24e, 0x869450b6, 0x80102c08, 0x0000098b, 0x00000988, 0x6e9ce24e, 0x80103593)
    TEST_SH_EX(0x84d2763c, 0x47cdf6da, 0x144dd2dc, 0x8010602a, 0x00008c34, 0x00008c34, 0x8011602a, 0x8010ec5e)
    TEST_SH_EX(0x9f5456ac, 0xe9095780, 0x132071c0, 0x8010b4a6, 0x0000104c, 0x0000104c, 0x9f5456ac, 0x8010c4f2)
    TEST_SH_EX(0xddc1ecc8, 0x5c7afd16, 0xeafff31c, 0x80103059, 0x000052c0, 0x000052c0, 0xddc1ecc8, 0x80108319)
    TEST_SH_EX(0x22af8548, 0x9a3cb6fc, 0xe5d23110, 0x8010698b, 0x000058c8, 0x000058c8, 0x22af8548, 0x8010c253)
    TEST_SH_EX(0x9178d200, 0x1629d100, 0x4edebd40, 0x80109af9, 0x00005be4, 0x00005be4, 0x9178d200, 0x8010f6dd)
    TEST_SH_EX(0xb1d33980, 0xb5b675b8, 0xb98946e1, 0x801029b9, 0x00004ee4, 0x00004ee4, 0xb1d33980, 0x8010789d)
    TEST_SH_EX(0x6bd8630c, 0x04ffbd8e, 0xc14e5012, 0x8010b3d7, 0x00000314, 0x00000314, 0x6bd8630c, 0x8010b6eb)
    TEST_SH_EX(0x58e6585f, 0x7ca8c284, 0x28c19a8e, 0x8010203c, 0x00008af5, 0x00008af4, 0x7ca8c284, 0x8010ab31)
    TEST_SH_EX(0x48970e71, 0x3a113c3a, 0xe5f8c5a5, 0x801035e9, 0x00007a24, 0x00007a24, 0x48970e71, 0x8010b00d)
    TEST_SH_EX(0x9b0f76fa, 0x83f10430, 0xa4a3c194, 0x8010545e, 0x00004d10, 0x00004d10, 0x9b0f76fa, 0x8010a16e)
    TEST_SH_EX(0xa762c450, 0x6337efd5, 0x63488960, 0x80100d38, 0x0000896b, 0x00008968, 0x6337efd5, 0x801096a3)
    TEST_SH_EX(0xb48d2c12, 0xf281b4f5, 0x17054010, 0x80102622, 0x0000cf8e, 0x0000cf8c, 0x80112622, 0x8010f5ae)
    TEST_SH_EX(0xd2aa45d4, 0xc308ec14, 0x2b81f980, 0x80105440, 0x0000083d, 0x0000083c, 0xc308ec14, 0x80105c7d)
    TEST_SH_EX(0x68dee0c6, 0x98b24ccc, 0x67d62603, 0x80100457, 0x0000cf98, 0x0000cf98, 0x80110457, 0x8010d3ef)
    TEST_SH_EX(0xef3709e2, 0x9993cf84, 0x03ab81f0, 0x80105c6a, 0x000088cf, 0x000088cc, 0x80115c6a, 0x8010e536)
    TEST_SH_EX(0xf24dc540, 0xd5142be0, 0x57364c58, 0x80101600, 0x000092c9, 0x000092c8, 0xd5142be0, 0x8010a8c9)
    TEST_SH_EX(0xe5f7d094, 0x350ad2f6, 0x8b978c80, 0x801028d5, 0x0000413a, 0x00004138, 0xe5f7d094, 0x80106a0d)
    TEST_SH_EX(0xb5a873c5, 0x1d84681e, 0x82e06ca0, 0x80108dff, 0x000056d1, 0x000056d0, 0xb5a873c5, 0x8010e4cf)
    TEST_SH_EX(0x2a633000, 0x106521e0, 0xf8cf1340, 0x8010213f, 0x000066a1, 0x000066a0, 0x2a633000, 0x801087df)
    TEST_SH_EX(0xcacfa30c, 0x0e92d804, 0x0978d210, 0x8010a0c7, 0x00000a10, 0x00000a10, 0xcacfa30c, 0x8010aad7)
    TEST_SH_EX(0x9163fc00, 0x9c80176b, 0x8d51a458, 0x80105254, 0x00000d3d, 0x00000d3c, 0x9c80176b, 0x80105f91)
    TEST_SH_EX(0x2f33d6ee, 0x036dcdd4, 0x32053576, 0x80100c92, 0x00004cb2, 0x00004cb0, 0x2f33d6ee, 0x80105942)
    TEST_SH_EX(0x2d69e57e, 0xc1f4dd98, 0xdc584fc6, 0x80106482, 0x0000854e, 0x0000854c, 0x80116482, 0x8010e9ce)
    TEST_SH_EX(0x7e7149b8, 0x873fc7e0, 0x4c544cd8, 0x801055d0, 0x00005ea5, 0x00005ea4, 0x873fc7e0, 0x8010b475)
    TEST_SH_EX(0x009aebbe, 0x8b38eecc, 0xa2ed3708, 0x8010b05e, 0x00002bc2, 0x00002bc0, 0x009aebbe, 0x8010dc1e)
    TEST_SH_EX(0xb8fd2f60, 0xea5f87d0, 0xa1607a37, 0x80101843, 0x000001e7, 0x000001e4, 0xb8fd2f60, 0x80101a27)
    TEST_SH_EX(0xb2f0b540, 0xa82dc109, 0x0e0b1d90, 0x80102888, 0x00001cbf, 0x00001cbc, 0xa82dc109, 0x80104547)
    TEST_SH_EX(0x5b51e7dc, 0x0b1a8adc, 0x8c7fa64b, 0x801012d1, 0x00002a0f, 0x00002a0c, 0x5b51e7dc, 0x80103cdd)
    TEST_SH_EX(0xed732238, 0x18d73e80, 0x2231c01a, 0x8010a3bb, 0x000039e0, 0x000039e0, 0xed732238, 0x8010dd9b)
    TEST_SH_EX(0xee3ec740, 0x503ef33c, 0xa191b340, 0x80101c78, 0x0000a993, 0x0000a990, 0x503ef33c, 0x8010c60b)
    TEST_SH_EX(0x350b9008, 0x8dcd59c0, 0xfcab066c, 0x80105f87, 0x00009238, 0x00009238, 0x80115f87, 0x8010f1bf)
    TEST_SH_EX(0x04481768, 0x4644cd64, 0x38ff18f0, 0x8010141e, 0x000083e0, 0x000083e0, 0x8011141e, 0x801097fe)
    TEST_SH_EX(0xff264f04, 0xcc0900b0, 0x9046a3e0, 0x80108c93, 0x00000f09, 0x00000f08, 0xff264f04, 0x80109b9b)
    TEST_SH_EX(0x4d453a68, 0xad46b020, 0x7d263f90, 0x8010d476, 0x00001f82, 0x00001f80, 0x4d453a68, 0x8010f3f6)
    TEST_SH_EX(0xfa751280, 0x487995ec, 0x030dc768, 0x8010b0da, 0x00003209, 0x00003208, 0xfa751280, 0x8010e2e2)
    TEST_SH_EX(0x99aa2470, 0xf20bae47, 0xc346d9d7, 0x801041e1, 0x00009df1, 0x00009df0, 0x801141e1, 0x8010dfd1)
    TEST_SH_EX(0xad83ca52, 0x977d7bd8, 0x8e913e74, 0x80106997, 0x00005ee2, 0x00005ee0, 0xad83ca52, 0x8010c877)
    TEST_SH_EX(0x1a261480, 0x3baefb5e, 0x44a59f74, 0x80103f7e, 0x00002822, 0x00002820, 0x1a261480, 0x8010679e)
    TEST_SH_EX(0x22c69d20, 0x8160ede0, 0x99433ab0, 0x80102d16, 0x00005060, 0x00005060, 0x22c69d20, 0x80107d76)
    TEST_SH_EX(0xec2267f4, 0xa2609fca, 0x10e5ff43, 0x8010369a, 0x00008255, 0x00008254, 0x8011369a, 0x8010b8ee)
    TEST_SH_EX(0x5cc110b4, 0x438a621a, 0xbcafe200, 0x80106b1c, 0x000086e1, 0x000086e0, 0x438a621a, 0x8010f1fd)
    TEST_SH_EX(0x71842ad8, 0x1b7da010, 0x8fe9c168, 0x80102659, 0x000095c0, 0x000095c0, 0x80112659, 0x8010bc19)
    TEST_SH_EX(0x667af3f0, 0xe0db1b92, 0xb4c8c64a, 0x8010202f, 0x00003db0, 0x00003db0, 0x667af3f0, 0x80105ddf)
    TEST_SH_EX(0x2262fd88, 0x60445033, 0x57d1af30, 0x8010dbb1, 0x00000210, 0x00000210, 0x2262fd88, 0x8010ddc1)
    TEST_SH_EX(0xf9c57a70, 0xfb22e430, 0x38126000, 0x80100b00, 0x00007fa7, 0x00007fa4, 0xfb22e430, 0x80108aa7)
    TEST_SH_EX(0x6da41d0a, 0x52564afc, 0x1767fd74, 0x80108e22, 0x00003919, 0x00003918, 0x6da41d0a, 0x8010c73a)
    TEST_SH_EX(0x41eb1160, 0x00864ee0, 0x474c7f58, 0x8010270f, 0x00003ee4, 0x00003ee4, 0x41eb1160, 0x801065f3)
    TEST_SH_EX(0x840b2e80, 0xc2a45090, 0xea156abc, 0x8010521f, 0x00000f48, 0x00000f48, 0x840b2e80, 0x80106167)
    TEST_SH_EX(0xb4b79f7a, 0xb5c454cc, 0xae3dd1b8, 0x80104a36, 0x0000753e, 0x0000753c, 0xb4b79f7a, 0x8010bf72)
    TEST_SH_EX(0x3e83b000, 0xe175654e, 0x56aaa600, 0x80104ea6, 0x000041ef, 0x000041ec, 0x3e83b000, 0x80109092)
    TEST_SH_EX(0x88e06b94, 0x86fdb22e, 0x2d71df40, 0x80108338, 0x000038f3, 0x000038f0, 0x86fdb22e, 0x8010bc2b)
    TEST_SH_EX(0x095af93c, 0x1571df10, 0xb098f820, 0x801096a0, 0x00000b8b, 0x00000b88, 0x1571df10, 0x8010a22b)
    TEST_SH_EX(0x4255a2f2, 0x759789ae, 0xfeedbe70, 0x80101002, 0x0000c545, 0x0000c544, 0x80111002, 0x8010d546)
    TEST_SH_EX(0x3eba16c4, 0xa2b4f60a, 0x18246800, 0x801079be, 0x00008280, 0x00008280, 0x801179be, 0x8010fc3e)
    TEST_SH_EX(0xa849c480, 0xc107cb88, 0x209cbe80, 0x80105744, 0x000095cf, 0x000095cc, 0xc107cb88, 0x8010ed13)
    TEST_SH_EX(0x47c29023, 0x903e3f20, 0x45bc8a58, 0x80104560, 0x00009b4d, 0x00009b4c, 0x903e3f20, 0x8010e0ad)
    TEST_SH_EX(0xbbd2851b, 0xae925800, 0xa19144c0, 0x80100e5e, 0x000091b6, 0x000091b4, 0x80110e5e, 0x8010a012)
    TEST_SH_EX(0x72390e28, 0x622ab57f, 0x0fc6ee46, 0x80101c9c, 0x00001ff7, 0x00001ff4, 0x622ab57f, 0x80103c93)
    TEST_SH_EX(0xa7ffce6b, 0x40a6539c, 0x7b4ee6fa, 0x8010207b, 0x00009da4, 0x00009da4, 0x8011207b, 0x8010be1f)
    TEST_SH_EX(0x0b2e55ec, 0x3c43d8b0, 0x119ecd60, 0x8010b406, 0x000003cd, 0x000003cc, 0x0b2e55ec, 0x8010b7d2)
    TEST_SH_EX(0xa3b6e920, 0xaf0a4f50, 0x52edda10, 0x801079ce, 0x000030f8, 0x000030f8, 0xa3b6e920, 0x8010aac6)
    TEST_SH_EX(0x241b6c60, 0xcee738f0, 0x68bb7c90, 0x80105a94, 0x00008b71, 0x00008b70, 0xcee738f0, 0x8010e605)
    TEST_SH_EX(0x8126453c, 0x6a5b542c, 0xf543a940, 0x80103772, 0x00006e4f, 0x00006e4c, 0x8126453c, 0x8010a5be)
    TEST_SH_EX(0x98eb6930, 0xd3ad56f2, 0xf99e7e92, 0x80100000, 0x00003c35, 0x00003c34, 0xd3ad56f2, 0x80103c35)
    TEST_SH_EX(0x704ce738, 0x72c67dde, 0x1c18eab0, 0x80100000, 0x0000a499, 0x0000a498, 0x72c67dde, 0x8010a499)
    TEST_SH_EX(0x23876340, 0x474a66ea, 0xd65c1fdd, 0x80100000, 0x00003267, 0x00003264, 0x474a66ea, 0x80103267)
    TEST_SH_EX(0xf81834e0, 0x66ccbdeb, 0x35393454, 0x80100000, 0x000082c3, 0x000082c0, 0x66ccbdeb, 0x801082c3)
    TEST_SH_EX(0xda7c7680, 0x94b3e915, 0xfb7278b0, 0x80100000, 0x0000deb7, 0x0000deb4, 0x94b3e915, 0x8010deb7)
    TEST_SH_EX(0x3c848358, 0x33f6d704, 0x171cb3f8, 0x80100000, 0x000043d3, 0x000043d0, 0x33f6d704, 0x801043d3)
    TEST_SH_EX(0x1523e2c1, 0x2be21470, 0x67eb7048, 0x80100000, 0x00000f19, 0x00000f18, 0x2be21470, 0x80100f19)
    TEST_SH_EX(0xaed979c0, 0xd1b44e6a, 0x9c45f3a8, 0x80100000, 0x00009559, 0x00009558, 0xd1b44e6a, 0x80109559)
    TEST_SH_EX(0xaadc7680, 0x10f24a00, 0x0c571a9e, 0x80100000, 0x0000f003, 0x0000f000, 0x10f24a00, 0x8010f003)
    TEST_SH_EX(0xeae4d64a, 0x2695f620, 0x509fd280, 0x80100000, 0x00000719, 0x00000718, 0x2695f620, 0x80100719)
    TEST_SH_EX(0x1403aef3, 0x376039a8, 0xbcf05e00, 0x80100000, 0x00000cb9, 0x00000cb8, 0x376039a8, 0x80100cb9)
    TEST_SH_EX(0x8bdbdeb0, 0x3ce42ca4, 0x20a96288, 0x80100000, 0x000019f1, 0x000019f0, 0x3ce42ca4, 0x801019f1)
    TEST_SH_EX(0x53fd998c, 0x3aec08f8, 0xe9b41540, 0x80100000, 0x0000a3bf, 0x0000a3bc, 0x3aec08f8, 0x8010a3bf)
    TEST_SH_EX(0x91732317, 0x0220a5a4, 0xd21d9480, 0x80110000, 0x00000001, 0x00000000, 0x0220a5a4, 0x80110001)
    TEST_SH_EX(0xc44f6094, 0xb4d4ce78, 0xc0e523ee, 0x80110000, 0x00000001, 0x00000000, 0xb4d4ce78, 0x80110001)
    TEST_SH_EX(0x82946a48, 0xcecf1b0c, 0xc2734000, 0x80110000, 0x00000001, 0x00000000, 0xcecf1b0c, 0x80110001)
    TEST_SH_EX(0x5dbecca1, 0x9bd328ea, 0x22afd1fc, 0x80110000, 0x00000003, 0x00000000, 0x9bd328ea, 0x80110003)
    TEST_SH_EX(0xadea8fa0, 0x66babb68, 0x93327bb8, 0x80110000, 0x00000003, 0x00000000, 0x66babb68, 0x80110003)
    TEST_SH_EX(0xf60dcac8, 0x41baa904, 0x3ea6c38c, 0x80110000, 0x00000003, 0x00000000, 0x41baa904, 0x80110003)
    TEST_SH_EX(0x88302998, 0x50d577ce, 0x87a4f180, 0x80110000, 0x00000001, 0x00000000, 0x50d577ce, 0x80110001)
    TEST_SH_EX(0x6cc3c5f5, 0x220c6f51, 0x27be3760, 0x80110000, 0x00000003, 0x00000000, 0x220c6f51, 0x80110003)
    TEST_SH_EX(0x94dd2a9a, 0x6d0a8ed2, 0xf90bb028, 0x80110000, 0x00000003, 0x00000000, 0x6d0a8ed2, 0x80110003)
    TEST_SH_EX(0xc8287c68, 0x962259b4, 0xfc9d42d0, 0x80110000, 0x00000003, 0x00000000, 0x962259b4, 0x80110003)
    TEST_SH_EX(0x714f2314, 0x259b6f00, 0xc83e307b, 0x80110000, 0x00000003, 0x00000000, 0x259b6f00, 0x80110003)
    TEST_SH_EX(0xef3cc1b2, 0xc07f5952, 0xca18dc2f, 0x80110000, 0x00000001, 0x00000000, 0xc07f5952, 0x80110001)
    TEST_SH_EX(0x1c7a0400, 0x4d8ae81e, 0x6dece3b8, 0x80110000, 0x00000001, 0x00000000, 0x4d8ae81e, 0x80110001)
    TEST_SH_EX(0x6c19d934, 0xfa9ffac2, 0x0c3f89d8, 0x80110000, 0x00000003, 0x00000000, 0xfa9ffac2, 0x80110003)
    TEST_SH_EX(0x4c831280, 0x506b1d40, 0xe5b8650c, 0x80110000, 0x00000001, 0x00000000, 0x506b1d40, 0x80110001)
    TEST_SH_EX(0x5a463928, 0x387554e2, 0x2161fa60, 0x80110000, 0x00000001, 0x00000000, 0x387554e2, 0x80110001)
    TEST_SH_EX(0xd15da2e4, 0x503fd1c0, 0xa2222a70, 0x80110000, 0x00000001, 0x00000000, 0x503fd1c0, 0x80110001)
    TEST_SH_EX(0xca06ea8c, 0xa44f48d0, 0xc3868c68, 0x80110000, 0x00000003, 0x00000000, 0xa44f48d0, 0x80110003)
    TEST_SH_EX(0x7a468a30, 0xa51136e0, 0xc1f5e658, 0x80110000, 0x00000003, 0x00000000, 0xa51136e0, 0x80110003)
    TEST_SH_EX(0xe624fda2, 0x042c0682, 0xd79f1ea0, 0x80110000, 0x00000001, 0x00000000, 0x042c0682, 0x80110001)
    TEST_SH_EX(0x8f2165aa, 0x4a946165, 0xcee04ebc, 0x80110000, 0x00000001, 0x00000000, 0x4a946165, 0x80110001)
    TEST_SH_EX(0xf7229f30, 0xfd56da80, 0x5f012ffc, 0x80110000, 0x00000003, 0x00000000, 0xfd56da80, 0x80110003)
    TEST_SH_EX(0x9f541ff2, 0x998295b0, 0xcef86862, 0x80110000, 0x00000003, 0x00000000, 0x998295b0, 0x80110003)
    TEST_SH_EX(0x0b9ab952, 0x8ccdf420, 0x64ea2f48, 0x80110000, 0x00000003, 0x00000000, 0x8ccdf420, 0x80110003)
    TEST_SH_EX(0x343ad1a8, 0x9f674a90, 0xccac1be0, 0x80110000, 0x00000003, 0x00000000, 0x9f674a90, 0x80110003)

###detect exception
###score ++
    addiu s3, s3, 1
###output a0|s3
inst_error:
    sw s3, 0($23)
    sw a0, 0(s1)
    jr ra
    nop
####END(n64_sh_ex_test)
